Skip to content

Conversation

@loject
Copy link

@loject loject commented Sep 18, 2025

Related GitHub Issue

Closes: #8140

Roo Code Task Context (Optional)

Description

This PR adds a "Show Debug Thoughts" feature for the LM Studio provider to help users detect infinite reasoning loops in open-source models like oss-gpt-20b.

Key implementation details:

  • Schema Extension: Added lmStudioShowDebugThoughts boolean field to the provider settings schema with proper Zod validation
  • API Integration: Enhanced the LM Studio handler to capture and conditionally display reasoning output from the delta.reasoning field
  • UI Component: Added a settings checkbox with descriptive label and help text in the LM Studio provider configuration panel
  • Localization: Implemented translations for both English and Russian locales
  • Type Safety: Maintained full TypeScript compatibility across all changes

Reviewers should pay attention to:

  • The reasoning output handling logic in src/api/providers/lm-studio.ts lines 123-133
  • Proper integration with existing XmlMatcher for <think> tags vs new reasoning field
  • UI placement and styling consistency with other LM Studio settings

Test Procedure

Manual Testing Steps:

  1. Open Roo Code settings and navigate to LM Studio provider configuration
  2. Verify the "Show Debug Thoughts" checkbox appears with proper label and description
  3. Toggle the checkbox and confirm the setting is saved
  4. Test with a reasoning-capable model (if available) to verify reasoning output display
  5. Verify localization by switching between English and Russian language settings

Automated Testing:

  • All existing unit tests pass (1075/1075 tests successful)
  • ESLint validation passes with no warnings
  • TypeScript compilation succeeds without errors
  • Settings schema validation works correctly

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Before: LM Studio settings without debug thoughts option
After: LM Studio settings with new "Show Debug Thoughts" checkbox and description

Screenshots will be provided once the PR is ready for submission

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required.

Documentation needs:

  • Update LM Studio provider documentation to mention the debug thoughts feature
  • Add troubleshooting section about detecting infinite reasoning loops
  • Include usage examples for debugging OSS model behavior

Additional Notes

  • This feature is opt-in and disabled by default to avoid UI clutter
  • The implementation differentiates between standard <think> tags (always processed) and the new reasoning field (conditionally displayed)
  • Performance impact is minimal when the feature is disabled
  • Compatible with existing LM Studio speculative decoding and draft model features

Get in Touch

Discord: loject


Important

Adds 'Show Debug Thoughts' feature to LM Studio provider, including schema, UI, and localization updates.

  • Behavior:
    • Adds lmStudioShowDebugThoughts boolean field to provider settings schema in provider-settings.ts.
    • Updates LmStudioHandler in lm-studio.ts to display reasoning output when lmStudioShowDebugThoughts is enabled.
  • UI:
    • Adds "Show Debug Thoughts" checkbox in LMStudio.tsx with label and description.
  • Localization:
    • Adds translations for "Show Debug Thoughts" feature in multiple locale files, including settings.json for ru, tr, vi, zh-CN, and zh-TW.

This description was created by Ellipsis for 61b108f. You can customize this summary. It will automatically update as commits are pushed.

- Add lmStudioShowDebugThoughts field to provider settings schema
- Implement reasoning output handling in LM Studio provider
- Add UI checkbox for enabling/disabling debug thoughts display
- Add localization for English and Russian languages
- Feature allows users to see model reasoning output when supported
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 18, 2025
Copy link
Contributor

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I've reviewed the changes and found several issues that need attention before this can be merged.

- Implemented a conditional check to display reasoning output in the UI when debug thoughts are enabled.
- Updated localization files to include new settings for showing debug thoughts in multiple languages.
- This feature allows users to view model reasoning output, enhancing transparency and debugging capabilities.
@loject loject marked this pull request as ready for review September 19, 2025 09:58
@loject loject requested review from cte, jr and mrubens as code owners September 19, 2025 09:58
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Sep 19, 2025
@RooCodeInc RooCodeInc deleted a comment from roomote bot Sep 23, 2025
@daniel-lxs
Copy link
Member

Hey @loject, thank you for your contribution!

Does it make sense to just enable reasoning for LM Studio? We already show reasoning for every other provider; it makes sense to do it here.

@daniel-lxs daniel-lxs moved this from Triage to PR [Changes Requested] in Roo Code Roadmap Sep 23, 2025
@hannesrudolph hannesrudolph added PR - Changes Requested and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 23, 2025
@loject
Copy link
Author

loject commented Sep 23, 2025

@daniel-lxs hi!
Just to clarify — here we’re talking about the debug reasoning traces, not the normal outputs. Some models (like gpt-oss-20b) don’t expose them in the standard stream, so it wouldn’t behave the same way as with the other providers.

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@loject loject closed this Oct 24, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 24, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add debug thoughts display for LM Studio to detect infinite loops in OSS models

3 participants